package cn.itsource.pojo.vo;

import cn.hutool.core.bean.BeanUtil;
import cn.itsource.pojo.domain.CustomerCar;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class UserCarVo {
    private Long id;
    private String carType;
    private String carPlate;

    public static UserCarVo CustomerCarToUserCar(CustomerCar customerCar){
        UserCarVo userCar = new UserCarVo();
        BeanUtil.copyProperties(customerCar,userCar);
        return userCar;
    }

    public static List<UserCarVo> CustomerCarToUserCars(List<CustomerCar> customerCar){
        return customerCar
                .stream()
                .map(UserCarVo::CustomerCarToUserCar)
                .toList();
     /*  List<UserCar> list = new ArrayList<>(customerCar.size());
      for (CustomerCar car : customerCar) {
           list.add(CustomerCarToUserCar(car));
        }
        return list;*/
    }
}
